package com.ibeeking.found.common.enums.sms;

/**
 * @ClassName SmsVendorEnum
 * @Description 短信供应商枚举
 * @Author ibeeking
 * @Date 2021-02-23 12:19
 **/
public enum SmsVendorEnum {
    SMS_ALI("阿里云短信", "SMS_ALI"),
    SMS_TECENT("腾讯短信", "SMS_TECENT"),
    SMS_SUBMAIL("赛迪短信", "SMS_SUBMAIL"),
    SMS_BAIDU("百度短信", "SMS_BAIDU"),
    SMS_UCPASS("云信短信", "SMS_UCPASS"),
    ;

    private String name;
    private String code;

    SmsVendorEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public static String getNameByCode(String code) {
        for (SmsVendorEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static SmsVendorEnum getEnumByCode(String code) {
        for (SmsVendorEnum enumObj : values()) {
            if (enumObj.getCode().equalsIgnoreCase(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
